import java.util.HashMap;
import java.util.Map;


/**
 * 通话详情类型枚举
 */
public enum CallRecordDetailTypeEnum {
    //全部
    ALL(null, "all"),
    //有效通话总数
    EFFECTIVE_TOTAL_NUM("effectiveTotalNum", "effectiveTotalNum");

    private String key;
    private String name;

    CallRecordDetailTypeEnum(String key, String name) {
        this.key = key;
        this.name = name;
    }

    private static final Map<String, CallRecordDetailTypeEnum> enumMap = new HashMap<>();

    static {
        for (CallRecordDetailTypeEnum typeEnum : values())
            enumMap.put(typeEnum.getKey(), typeEnum);
    }

    public static String selector(String key) {
        CallRecordDetailTypeEnum typeEnum = enumMap.get(key);
        if (typeEnum == null)
            return null;
        return typeEnum.name;
    }


    public String getKey() {
        return key;
    }
}
